﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

namespace LearnEnglishWords.UI.Converters
{
    public class BoolToVisibilityConverter :DependencyObject,  IValueConverter
    {


        public Object TrueValue
        {
            get { return (Object)GetValue(TrueValueProperty); }
            set { SetValue(TrueValueProperty, value); }
        }

        public static readonly DependencyProperty TrueValueProperty =
            DependencyProperty.Register("TrueValue", typeof(Object), typeof(BoolToVisibilityConverter), new PropertyMetadata(null));



        public Object FalseValue
        {
            get { return (Object)GetValue(FalseValueProperty); }
            set { SetValue(FalseValueProperty, value); }
        }

        public static readonly DependencyProperty FalseValueProperty =
            DependencyProperty.Register("FalseValue", typeof(Object), typeof(BoolToVisibilityConverter), new PropertyMetadata(null));



        public object Convert(object value, Type targetType, object parameter, string language)
        {
            if (value == null)
                return FalseValue;

            return value.ToString().ToLower() == parameter.ToString().ToLower() ? TrueValue : FalseValue;
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            throw new NotImplementedException();
        }
    }
}
